apiVersion: v1
kind: Service
metadata:
  name: {{ include "spilo-art.fullname" . }}
  labels:
    {{- include "spilo-art.labels" . | nindent 4 }}
  {{- if .Values.service.annotations }}
  annotations:
    {{- toYaml .Values.service.annotations | nindent 4 }}
  {{- end}}
spec:
  type: {{ .Values.service.type }}
  ports:
  - name: {{ .Values.service.name }}
    port: {{ .Values.service.port }}
    targetPort: 5432
    {{- if and (eq .Values.service.type "NodePort") .Values.service.nodePort }}
    nodePort: {{ .Values.service.nodePort}}
    {{- end }}